{include file="kuyou/common/menu" /}
<div class="">
    <a href="{:url('kuyou/prints/prints',['id'=>$row.id,'type'=>'cbtzd'])}" target="_blank" class="layui-btn layui-icon-btn layui-btn-sm layui-btn-danger fright {if condition="$auth->check($nowmenu.'/printss')!=1"}hiddens{/if}" style="margin-left: 10px;padding-left: 10px;">{:__('Print')}</a>
</div>
<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">

    <div class="row">
        <div class="col-xs-12 col-sm-5 col-md-5 col-lg-5">
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-4">{:__('Purchase_code')}:</label>
                <div class="col-xs-12 col-sm-8">
                    <input id="c-purchase_code" class="form-control" value="{$row.purchase_code|default=''}" data-rule="required" name="row[purchase_code]" type="text" placeholder="{:__('Purchase_code')}">
                    <input class="form-control" value="{$row.purchase_code|default=''}" name="row[purchase_old_code]" type="hidden">
                </div>
            </div>
        </div>
        <div class="col-xs-12 col-sm-5 col-md-5 col-lg-5">
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-4">{:__('Purchase_time')}:</label>
                <div class="col-xs-12 col-sm-8">
                    <input id="c-purchase_time" class="form-control" data-use-current="true" name="row[purchase_time]" type="text" value="{$row.purchase_time|date='Y-m-d',###}" placeholder="{:__('Purchase_time')}">
                </div>
            </div>
        </div>
    </div>
    <div class="list" style="overflow-x: auto">
        <table id="goods_table">
            <tr>
                <th></th>
                <th>
                    <span class="must">*</span>
                    {:__('commodity')}
                    <span class="smq_switch">
                            <span>--{:__('Scan code gun input')}</span>
                            <span>
                                <input  id="c-switch" name="row[switch]" type="hidden" value="0">
                                <a href="javascript:;" data-toggle="switcher" class="btn-switcher" data-input-id="c-switch" data-yes="1" data-no="0" >
                                    <i class="fa fa-toggle-on text-success fa-2x fa-flip-horizontal text-gray"></i>
                                </a>
                            </span>
                        </span>
                </th>
                <th>{:__('Goods_unit')}</th><th> {:__('Adjust the amount')}</th><th>{:__('Stores_id')}</th><th>{:__('Remark')}</th>
            </tr>
            <tr style="display: none;">
                <td><div class="btn"><span class="add"><i class="fa fa-plus"></i></span><span class="del"><i class="fa fa-trash"></i></span></div></td>
                <td>
                    <div class="goods_code_box">
                        <input type="hidden" name="row[goods_id][]" class="goods_id">
                        <span class="goods_code_span"><img src="__CDN__/assets/addons/kuyou/img/more.png"></span>
                        <input type="text" class="ipt goods_name">
                    </div>
                </td>
                <td>
                    <div>
                        <select name="row[goods_unit][]" class="form-control goods_unit">
                            <option value=""></option>
                        </select>
                    </div>
                </td>
                <td><div><input type="number" name="row[price][]" class="price price_decimal"></div></td>
                <td>
                    <div>
                        <select name="row[stores_id][]" class="form-control stores_id">
                            <option value=""></option>
                            {foreach name="storesList" item="vo"}
                            <option value="{$vo.id}">{$vo.name}</option>
                            {/foreach}
                        </select>
                    </div>
                </td>
                <td><div><input type="text" name="row[remark][]" class="remark"></div></td>
            </tr>
            {foreach name="adjustment_info" item="info" key="k"}
            <tr>
                <td><div class="btn"><span class="add"><i class="fa fa-plus"></i></span><span class="del"><i class="fa fa-trash"></i></span></div></td>
                <td>
                    <div class="goods_code_box">
                        {foreach name="goodsList" item="vo"}
                        {if condition="$vo.id==$info.goods_id"}{php}$shelf_life = $vo['shelf_life'];{/php}
                        <input type="hidden" name="row[goods_id][]" class="goods_id" value="{$vo.id}">
                        <span class="goods_code_span"><img src="__CDN__/assets/addons/kuyou/img/more.png"></span>
                        <input type="text" class="ipt goods_name" value="{$vo.goods_code} {$vo.goods_name}">
                        {/if}
                        {/foreach}
                    </div>
                </td>
                <td>
                    <div>
                        <select name="row[goods_unit][]" class="form-control goods_unit">
                            <option value=""></option>
                            {foreach name="info.unit.unit" item="vo"}
                            <option value="{$vo.id}" {if condition="$vo.id==$info.goods_unit"}selected{/if}>{$vo.name}</option>
                            {/foreach}
                        </select>
                    </div>
                </td>
                <td><div><input type="number" name="row[price][]" value="{$info.money}" class="price price_decimal"></div></td>
                <td>
                    <div>
                        <select name="row[stores_id][]" class="form-control stores_id">
                            <option value=""></option>
                            {foreach name="storesList" item="vo"}
                            <option value="{$vo.id}" {if condition="$vo.id==$info.stores_id"}selected{/if}>{$vo.name}</option>
                            {/foreach}
                        </select>
                    </div>
                </td>
                <td><div><input type="text" name="row[remark][]" class="remark" value="{$info.remark}"></div></td>
            </tr>
            {/foreach}
            {php}for($a=0;$a<(4-sizeof($adjustment_info));$a++){ {/php}
            <tr>
                <td><div class="btn"><span class="add"><i class="fa fa-plus"></i></span><span class="del"><i class="fa fa-trash"></i></span></div></td>
                <td>
                    <div class="goods_code_box">
                        <input type="hidden" name="row[goods_id][]" class="goods_id">
                        <span class="goods_code_span"><img src="__CDN__/assets/addons/kuyou/img/more.png"></span>
                        <input type="text" class="ipt goods_name">
                    </div>
                </td>
                <td>
                    <div>
                        <select name="row[goods_unit][]" class="form-control goods_unit">
                            <option value=""></option>
                        </select>
                    </div>
                </td>
                <td><div><input type="number" name="row[price][]" class="price price_decimal"></div></td>
                <td>
                    <div>
                        <select name="row[stores_id][]" class="form-control stores_id">
                            <option value=""></option>
                            {foreach name="storesList" item="vo"}
                            <option value="{$vo.id}">{$vo.name}</option>
                            {/foreach}
                        </select>
                    </div>
                </td>
                <td><div><input type="text" name="row[remark][]" class="remark"></div></td>
            </tr>
            {php}}{/php}
        </table>
    </div>
    <div class="chose_goods_boxs"></div>

    <div class="row" style="margin-bottom: 10px;">
        <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
            <textarea id="c-note" class="form-control" rows="4" name="row[note]" cols="30" placeholder="{:__('Remarks Information')}">{$row.remark|default=''}</textarea>
        </div>
    </div>
    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>
</form>
